package com.lin.zoo.view;

import com.lin.zoo.controller.UserController;
import javax.swing.*;
import com.lin.zoo.controller.CookieController;
import com.lin.zoo.po.Cookie;

public class LoginPage extends JPanel {
    CookieController controller=new CookieController();

    private UserController userController;

    private JLabel labAccount = new JLabel("用户名");

    private JTextField jtaText;

    private JLabel labPassword = new JLabel("密码");

    private JPasswordField jtbText;

    private JButton btnLogin = new JButton("登录");

    private JButton btnSign = new JButton("注册");


    public UserController getUserController() {
        return userController;
    }

    public void setUserController(UserController userController) {
        this.userController = userController;
    }



    public JLabel getLabAccount() {
        return labAccount;
    }

    public void setLabAccount(JLabel labAccount) {
        this.labAccount = labAccount;
    }

    public JTextField getJtaText() {
        return jtaText;
    }

    public void setJtaText(JTextField jtaText) {
        this.jtaText = jtaText;
    }

    public JLabel getLabPassword() {
        return labPassword;
    }

    public void setLabPassword(JLabel labPassword) {
        this.labPassword = labPassword;
    }

    public JPasswordField getJtbText() {
        return jtbText;
    }

    public void setJtbText(JPasswordField jtbText) {
        this.jtbText = jtbText;
    }

    public JButton getBtnLogin() {return btnLogin;}

    public JButton getBtnSign() {
        return btnSign;
    }

    public void setBtnLogin(JButton btnLogin) {
        this.btnLogin = btnLogin;
    }

    public void setBtnSign(JButton btnSign) {
        this.btnSign = btnSign;
    }

    public LoginPage() {

        init();
        add(labAccount);
        add(labPassword);
        add(jtaText);
        add(jtbText);
        add(btnLogin);
        add(btnSign);
        setLayout(null);
    }

    private void init(){
        Cookie cookie=controller.getcookie();

        labAccount.setSize(200,100);
        labAccount. setLocation(130,50);

        jtaText = new JTextField(cookie.getName());
        jtaText.setSize(190,30);
        jtaText.setLocation(180,90);

        labPassword.setSize(200,100);
        labPassword.setLocation(130,105);

        jtbText = new JPasswordField(cookie.getPassword());
        jtbText.setSize(190,30);
        jtbText.setLocation(180,140);

        btnLogin.setSize(90, 30);
        btnLogin.setLocation(150, 200);

        btnSign.setSize(90,30);
        btnSign.setLocation(280,200);
    }
}
